package com.ruoyi.stream.framework.enums;

import com.ruoyi.stream.framework.model.request.RequestProcessor;
import com.ruoyi.stream.framework.model.request.SingleTaskProcessor;

import java.lang.reflect.Constructor;

public enum IOType {
    SINGLE("single", SingleTaskProcessor.class),
    MULTICAST("multicast", SingleTaskProcessor.class)
    ;

    public final String type;

    public final Class<? extends RequestProcessor> processorClass;

    public final Constructor<? extends RequestProcessor> constructor;

    IOType(String type,Class<? extends RequestProcessor> processorClass) {
        this.type = type;
        this.processorClass = processorClass;
        try {
            this.constructor = processorClass.getConstructor();
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        }
    }
}
